package com.zy.web.controller.business;

import com.zy.business.domain.TbHoliday;
import com.zy.common.core.controller.BaseController;
import com.zy.common.core.domain.AjaxResult;
import com.zy.business.mapper.HolidayMapper;
import com.zy.business.service.HolidayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description: 工作日控制器
 * @author: whf
 * @create: 2022-04-26 09:56
 **/
@RestController
@Api(tags = "工作日接口")
@RequestMapping("/holiday")
public class HolidayController extends BaseController {

    @Autowired
    private HolidayService holidayService;

    @Resource
    private HolidayMapper holidayMapper;

    @ApiOperation("获取某月的工作日列表")
    @GetMapping("/list")
    public AjaxResult List(@RequestParam("month") String month){
        List<TbHoliday> holidayList = holidayMapper.getListByMonth(month);
        return AjaxResult.success(holidayList);
    }


    @ApiOperation("修改工作日状态")
    @PostMapping("/saveHoliday")
    public AjaxResult saveHoliday(@RequestBody TbHoliday holiday){
        holidayService.updateById(holiday);
        return AjaxResult.success();
    }

}
